<!DOCTYPE html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<!--
    对象本身的两个方法
    * get propertyName(){} 用来得到当前属性值的回调函数
    * set propertyName(){} 用来监视当前属性值变化的回调函数
-->
<script type='text/javascript'>
  var obj = {
    firstName: 'kobe',
    lastName: 'bryant',
    get fullName() {
      return this.firstName + ' ' + this.lastName
    },
    set fullName(data) {
      var names = data.split(' ');
      this.firstName = names[0];
      this.lastName = names[1];
    }
  };
  console.log(obj.fullName);
  obj.fullName = 'curry stephen';
  console.log(obj.fullName);
</script>
</body>
</html>
